// 设置注册步骤
export const SET_SIGN_UP_SETP = (state, step) => {
  state.signUpStep = step;
};

// 设置token
export const SET_TOKEN = (state, token) => {
  state.token = token
}

// 设置用户登录信息
export const SET_USER_LOGIN_INFO = (state, data) => {
  state.userInfo = data;
};

// 设置加载状态
export const SET_LOAD_STATUS = (state, status) => {
  state.isLoading = status;
};

// 设置秒杀商品
export const SET_SECKILLS_INFO = (state, seckills) => {
  state.seckills.goodsList = seckills[0];
  state.seckills.deadline = seckills[1];
};

// 设置轮播(营销)图
export const SET_CAROUSELITEMS_INFO = (state, { carouselItems, activity }) => {
  state.marketing.CarouselItems = carouselItems;
  state.marketing.activity = activity;
};

// 设置电脑专栏数据
export const SET_COMPUTER_INFO = (state, computer) => {
  state.computer = computer;
};

// 设置爱吃专栏数据
export const SET_EAT_INFO = (state, eat) => {
  state.eat = eat;
};

// 减少秒杀时间
export const REDUCE_SECKILLS_TIME = state => {
  state.seckills.deadline.seconds--;
  if (state.seckills.deadline.seconds === -1) {
    state.seckills.deadline.seconds = 59;
    state.seckills.deadline.minute--;
    if (state.seckills.deadline.minute === -1) {
      state.seckills.deadline.minute = 59;
      state.seckills.deadline.hour--;
    }
  }
};

// 设置商品列表(搜索)
export const SET_GOODS_LIST = (state, data) => {
  state.goodsList = data.goodsList;
  state.asItems = data.asItems;
};

// 设置商品列表排序
export const SET_GOODS_ORDER_BY = (state, data) => {
  state.orderBy = data;
};

// 设置商品详细信息
export const SET_GOODS_INFO = (state, data) => {
  state.goodsInfo = data;
};

// 添加购物车
export const ADD_SHOPPING_CART = (state, data) => {
  state.cartList = data;
};

// 购物车数量
export const SHOPPING_CART_NUM = (state, data) => {
  state.cartNum = data;
};

// 设置购物车信息
export const SET_SHOPPING_CART = (state, data) => {
  state.shoppingCart = data;
};

// 设置推荐信息
export const SET_RECOMMEND_INFO = (state, data) => {
  state.recommend = data;
};

// 设置收获地址
export const SET_USER_ADDRESS = (state, data) => {
  state.address = data;
};

// 设置全局购物车数据
export const SET_CART_DATA = (state, data) => {
  state.cartData = data;
};

// 设置全局购物车数据
export const SET_ADDRESS_LIST = (state, data) => {
  state.addressList = data;
};
// 设置全局购物车数据
export const SET_ADDRESS_INDEX = (state, data) => {
  state.curAddressIndex = data;
};

// 设置全局购物车数据
export const SET_ORDER_DATA = (state, data) => {
  state.orderData = data;
};

// 设置全局购物车数据
export const SET_MY_BALANCE = (state, data) => {
  state.myBalance = data;
};
// 设置全局购物车数据
export const SET_LANG_LIST = (state, data) => {
  state.langList = data;
};

export const SET_LOCAL_LANG = (state, data) => {
  state.localLang = data;
};
export const SET_MSG_COUNT = (state, data) => {
  state.msgCount = data;
};

export const SET_SEARCH_KEY = (state, data) => {
  state.searchKey = data;
};

export const SET_NATION_CODE = (state, data) => {
  state.nationCodeData = data;
};
